document.writeln("<!DOCTYPE html>");
document.writeln("<html>");
document.writeln("");
document.writeln("<head>");
document.writeln("  <meta charset=\"utf-8\">");
document.writeln("  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">");
document.writeln("  <title>开始使用 layui</title>");
document.writeln("  <link rel=\"stylesheet\" href=\"../plugs/layui/src/css/layui.css\">");
document.writeln("  <link rel=\"stylesheet\" href=\"../css/zlxindex.css\">");
document.writeln("  <style>");
document.writeln("    .right-nav {");
document.writeln("      left: 400px;");
document.writeln("      margin-right: 20px;");
document.writeln("    }");
document.writeln("  </style>");
document.writeln("</head>");
document.writeln("");
document.writeln("<body>");
document.writeln("  <div id=\"app\">");
document.writeln("    <div class=\"head\">");
document.writeln("      <ul class=\"layui-nav\" lay-filter=\"\" \">");
document.writeln("      <li class=\" layui-nav-item layui-this\"><a");
document.writeln("          href=\"http://localhost:70/cattle-and-horses-oj-html/html/index.html\"><img src=\"../image/logo.png\"");
document.writeln("            class=\"layui-nav-img\"></a></li>");
document.writeln("        <li class=\"layui-nav-item \"><a href=\"index.html\">学习</a></li>");
document.writeln("        <li class=\"layui-nav-item\"><a href=\"problem.html\">题库</a></li>");
document.writeln("        <li class=\"layui-nav-item\"><a href=\"circle.html\">讨论</a></li>");
document.writeln("        <li class=\"layui-nav-item\"><a href=\"competition.html\">竞赛</a></li>");
document.writeln("        <li class=\"layui-nav-item\"><a href=\"\">求职</a></li>");
document.writeln("        <li class=\"layui-nav-item\">");
document.writeln("          <a href=\"javascript:;\">商店</a>");
document.writeln("          <dl class=\"layui-nav-child\">");
document.writeln("            <!-- 二级菜单 -->");
document.writeln("            <dd><a href=\"\">移动模块</a></dd>`");
document.writeln("            <dd><a href=\"\">后台模版</a></dd>");
document.writeln("            <dd><a href=\"\">电商平台</a></dd>");
document.writeln("          </dl>");
document.writeln("        </li>");
document.writeln("        <li class=\"layui-nav-item right-nav\"><button type=\"button\"");
document.writeln("            class=\"layui-btn layui-btn-primary layui-border-orange  layui-btn-sm\" id=\"vipbnt\">开通Plus会员</button></li>");
document.writeln("        <li class=\"layui-nav-item right-nav\"><button onclick=\"mianshi()\" type=\"button\"");
document.writeln("            class=\"layui-btn layui-btn-primary layui-border-blue  layui-btn-sm\">牛码面试</button></li>");
document.writeln("");
document.writeln("        <li class=\"layui-nav-item right-nav\">");
document.writeln("          <a href=\"javascript:mess();\">消息<span class=\"layui-badge\" style=\"width: 20px;\">0</span></a>");
document.writeln("        </li>");
document.writeln("        <li class=\"layui-nav-item right-nav\"><a href=\"register.html\"><span>注册</span></a></li>");
document.writeln("        <li class=\"layui-nav-item right-nav \">");
document.writeln("          <a href=\"login.html\"><img id=\"avatar\" src=\"../image/logo.png\" class=\"layui-nav-img\"> <span");
document.writeln("              id=\"nickname\">登录</span></a>");
document.writeln("          <dl class=\"layui-nav-child\">");
document.writeln("            <dd><a href=\"javascript:;\">修改信息</a></dd>");
document.writeln("            <dd><a href=\"personal.html\">个人中心</a></dd>");
document.writeln("            <dd><a href=\"javascript:exit();\">退了</a></dd>");
document.writeln("          </dl>");
document.writeln("        </li>");
document.writeln("      </ul>");
document.writeln("    </div>");
document.writeln("");
document.writeln("  </div>");
document.writeln("  <!-- 你的 HTML 代码 -->");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("  <script src=\"../plugs/layui/src/layui.js\"></script>");
document.writeln("  <script src=\"../js/jquery.min.js\"></script>");
document.writeln("  <script src=\"../js/vue.js\"></script>");
document.writeln("  <script>");
document.writeln("");
document.writeln("    layui.use([\'layer\', \'form\'], function () {");
document.writeln("      var layer = layui.layer");
document.writeln("        , form = layui.form;");
document.writeln("    });");
document.writeln("    layui.use(\'element\', function () {");
document.writeln("      var element = layui.element;");
document.writeln("");
document.writeln("      //…");
document.writeln("    });");
document.writeln("");
document.writeln("    $(function () {");
document.writeln("      let clientID = \"\";");
document.writeln("");
document.writeln("      //链接服务器...");
document.writeln("      function connect(res) {");
document.writeln("        let ws;");
document.writeln("        if (\"WebSocket\" in window) {");
document.writeln("          // var socket =  new  ReconnectingWebSocket（url，null，{debug ： true，reconnectInterval ： 3000 }）");
document.writeln("          clientID = res.msg;");
document.writeln("          ws = new WebSocket(\"ws://localhost:70/webSocket/dev/web/\" + clientID);");
document.writeln("");
document.writeln("          ws.onopen = function () {");
document.writeln("            console.log(\"链接成功....\");");
document.writeln("            ws.send(\"你好服务端！我是客户端 \" + clientID);");
document.writeln("          }");
document.writeln("");
document.writeln("");
document.writeln("          ws.onmessage = function (res) {");
document.writeln("            let msg = res.data;");
document.writeln("            if (msg === \'ping\') {");
document.writeln("              console.log(\'心跳....\');");
document.writeln("            }");
document.writeln("            else {");
document.writeln("              let info_counts = parseInt($(\".layui-badge\").text()) + 1;");
document.writeln("              $(\".layui-badge\").text(info_counts);");
document.writeln("              alert(\"您有新的消息...\")");
document.writeln("            }");
document.writeln("          };");
document.writeln("");
document.writeln("");
document.writeln("          ws.onclose = function () {");
document.writeln("            console.log(\"链接关闭....\");");
document.writeln("");
document.writeln("          };");
document.writeln("        }");
document.writeln("      }");
document.writeln("      //链接结束.....");
document.writeln("");
document.writeln("      todetail = function (self) {");
document.writeln("        let discussId = self.previousElementSibling.value;");
document.writeln("        let commentid = self.nextElementSibling.value;");
document.writeln("        $.post(\'http://localhost:70/devu/discuss/read\', { commentid: commentid }, function (res) {");
document.writeln("          if (res.code == \"200\") {");
document.writeln("            window.location = \"discuss.html?id=\" + discussId;");
document.writeln("          }");
document.writeln("        })");
document.writeln("");
document.writeln("      }");
document.writeln("");
document.writeln("      $(\"#vipbnt\").click(function () {");
document.writeln("        let token = localStorage.getItem(\"token\");");
document.writeln("        if (token == null) {");
document.writeln("          alert(\"请先登录\");");
document.writeln("        }");
document.writeln("        else {");
document.writeln("          if ($(\"#vipbnt\").text() == \"超级plus会员\") {");
document.writeln("            alert(\"您已经是会员了\")");
document.writeln("          }");
document.writeln("          else {");
document.writeln("            $.ajax({");
document.writeln("              type: \"post\",");
document.writeln("              headers: { token: localStorage.getItem(\"token\") },");
document.writeln("              url: \'http://localhost:70/devu/user/vip\',");
document.writeln("              success: function (res) {");
document.writeln("                $(\"body\").html(res.content);");
document.writeln("              }");
document.writeln("");
document.writeln("            })");
document.writeln("          }");
document.writeln("        }");
document.writeln("      })");
document.writeln("");
document.writeln("      //TODO消息弹出层");
document.writeln("      mess = function () {");
document.writeln("        let contents = \"\";");
document.writeln("        if (clientID != \"\") {");
document.writeln("          $.ajax({");
document.writeln("            type: \"get\",");
document.writeln("            url: \"http://localhost:70/devu/discuss/comment\",");
document.writeln("            data: { clientID: clientID },");
document.writeln("            success: function (res) {");
document.writeln("              console.log(res);");
document.writeln("              if (res.code == \"200\") {");
document.writeln("                comment = res.content;");
document.writeln("");
document.writeln("                for (let key in comment) {");
document.writeln("                  let avatar = comment[key].cavatar;");
document.writeln("                  let cont = comment[key].content;");
document.writeln("                  let discuss_id = comment[key].discussId;");
document.writeln("                  let cId = comment[key].cid;");
document.writeln("                  if (cont.length > 10) {");
document.writeln("                    cont = cont.substring(0, 15) + \".....\";");
document.writeln("                  }");
document.writeln("                  contents += `<div style=\"width: 260px; padding: 20px;\" onclick=\"todis(this)\">     ");
document.writeln("    <img src=\"../image/${avatar}\" style=\"height: 40px;width: 40px;\">");
document.writeln("    <input type=\"hidden\" style=\"width: 1px;height:1px\" value=\"${discuss_id}\"><span style=\"margin-left: 20px;\" onclick=\"todetail(this)\">${cont}</span>");
document.writeln("    <input type=\"hidden\" style=\"width: 1px;height:1px\" value=\"${cId}\">");
document.writeln("  </div>`;");
document.writeln("                }");
document.writeln("");
document.writeln("                let layers = layer.open({");
document.writeln("                  type: 1,");
document.writeln("                  title: false,");
document.writeln("                  closeBtn: 0,");
document.writeln("                  offset: [\'80px\', \'1220px\'],");
document.writeln("                  scrollbar: true,");
document.writeln("                  shadeClose: true,");
document.writeln("                  skin: \'yourclass\',");
document.writeln("                  content: contents");
document.writeln("                });");
document.writeln("                console.log(layers.content)");
document.writeln("");
document.writeln("");
document.writeln("              }");
document.writeln("            }");
document.writeln("          })");
document.writeln("");
document.writeln("        }");
document.writeln("");
document.writeln("");
document.writeln("      }");
document.writeln("      //TODO消息弹出层");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("      let token = localStorage.getItem(\"token\");");
document.writeln("      if (token != null && token.trim().length > 0) {");
document.writeln("        $.ajax({");
document.writeln("          type: \"get\",");
document.writeln("          headers: { token: token },");
document.writeln("          url: \"http://localhost:70/devu/user/userinfo\",");
document.writeln("          success: function (res) {");
document.writeln("            console.log(res);");
document.writeln("            if (res.code == \"200\") {");
document.writeln("              let content = res.content;");
document.writeln("              $(\"#nickname\").html(content.nickname);");
document.writeln("              $(\"#avatar\").attr(\"src\", \"http://localhost:70/cattle-and-horses-oj-html/image/\" + content.avatar);");
document.writeln("              comment = content.commentOneVo;");
document.writeln("              $(\".layui-badge\").text(content.counts);");
document.writeln("              //合法请求，链接websocket");
document.writeln("              if (content.isvip == \"1\") {");
document.writeln("                $(\"#vipbnt\").text(\"超级plus会员\");");
document.writeln("              }");
document.writeln("              connect(res);");
document.writeln("              //TODO...请求后端链接....");
document.writeln("");
document.writeln("");
document.writeln("            }");
document.writeln("          }");
document.writeln("        })");
document.writeln("");
document.writeln("      } else {");
document.writeln("        $(\".layui-badge\").css(\"display\", \"none\");");
document.writeln("      }");
document.writeln("    })");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("");
document.writeln("    todis = function () {");
document.writeln("");
document.writeln("    }");
document.writeln("");
document.writeln("");
document.writeln("    exit = function () {");
document.writeln("");
document.writeln("      localStorage.clear();");
document.writeln("      window.location = \"login.html\";");
document.writeln("    }");
document.writeln("");
document.writeln("    function mianshi() {");
document.writeln("      token = localStorage.getItem(\"token\");");
document.writeln("      if (token == null) {");
document.writeln("        alert(\"请您先登录\")");
document.writeln("      } else {");
document.writeln("        window.location = \"photo.html\";");
document.writeln("      }");
document.writeln("");
document.writeln("    }");
document.writeln("  </script>");
document.writeln("</body>");
document.writeln("");
document.writeln("</html>");